package com.edt.ichannel.api.service.impl;

import cc.edt.iceutils2.random.IceRandomUtils;
import com.edt.ichannel.api.entiy.local.ConsumeLog;
import com.edt.ichannel.api.entiy.local.WebApiEntity;
import com.edt.ichannel.api.service.ConvertDataService;
import org.springframework.stereotype.Service;

import java.util.Date;

@Service
public class ConvertDataServiceImpl implements ConvertDataService {
    @Override
    public ConsumeLog convertDataToConsume(WebApiEntity entity) {
        if(entity == null){
            return null;
        }
        ConsumeLog consumeLog = new ConsumeLog();
        consumeLog.setId(IceRandomUtils.longUUID());
        consumeLog.setAddTime(new Date());
        consumeLog.setMechanismsId(entity.getMechanismsid());
        consumeLog.setPhone(entity.getPhone());
        consumeLog.setShopName(entity.getShopname());
        consumeLog.setPayMoney(entity.getPaymoney());
        consumeLog.setFlowValue(entity.getFlowvalue());
        return consumeLog;
    }
}
